{% extends "base.html" %}
{% block  title %}资产详情{% endblock %}
{% load  mytags %}
{% block header-css %}

{% load bootstrap3 %}
{% endblock %}


{% block  page-content %}

    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>资产详情</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="/index.html">主页</a>
                </li>
                <li>
                    <a href="asset.html">资产管理</a>
                </li>
                <li class="active">
                    <strong>资产详情</strong>
                </li>
            </ol>
        </div>
        <div class="col-lg-2">

        </div>
    </div>

    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="panel-options">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a class="text-center"><i class="fa fa-laptop"></i>资产详情</a>
                            </li>
                            <li class="pull-right">
                                <a class="btn btn-outline btn-default" href="{% url "asset:asset_update"  nid %}"><i
                                        class="fa fa-edit"></i>编辑</a>
                            </li>
                            <li class="pull-right">
                                <a class="btn btn-outline btn-danger  asset_del" >
                                    <i class="fa fa-edit"></i>删除
                                </a>
                            </li>

                        </ul>
                    </div>
                    <div class="tab-content">
                        <div class="col-sm-7" style="padding-left: 0">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <span class="label"><b>{{ assets.network_ip }}</b></span>
                                    <div class="ibox-tools">
                                        <a class="collapse-link">
                                            <i class="fa fa-chevron-up"></i>
                                        </a>
                                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                            <i class="fa fa-wrench"></i>
                                        </a>
                                        <ul class="dropdown-menu dropdown-user">
                                        </ul>
                                        <a class="close-link">
                                            <i class="fa fa-times"></i>
                                        </a>
                                    </div>
                                </div>
                                <div class="ibox-content">

                                    <table class="table">
                                        <tbody>
                                        <tr>
                                            <td style=" border-top: none !important;" width="20%">主机名:</td>
                                            <td style=" border-top: none !important;"><b>{{ assets.hostname }}</b>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="20%">外网IP:</td>
                                            <td><b>{{ assets.network_ip }}</b>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="20%">管理IP:</td>
                                            <td><b>{{ assets.manage_ip }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">内网IP:</td>
                                            <td><b>{{ assets.inner_ip }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">SSH端口:</td>
                                            <td><b>{{ assets.port }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">登陆用户:</td>
                                            <td><b>{{ assets.system_user }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">上联端口:</td>
                                            <td><b>{{ assets.uplink_port }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">产品线:</td>
                                            <td><b>{{ assets.product_line }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">是否启用:</td>
                                            <td><b>{{ assets.is_active }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">数据中心:</td>
                                            <td><b>{{ assets.data_center }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">机柜:</td>
                                            <td><b>{{ assets.cabinet }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">位置:</td>
                                            <td><b>{{ assets.position }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">型号:</td>
                                            <td><b>{{ assets.model }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">系统版本:</td>
                                            <td><b>{{ assets.system }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">SN:</td>
                                            <td><b>{{ assets.sn }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">CPU:</td>
                                            <td><b>{{ assets.cpu }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">内存:</td>
                                            <td><b>{{ assets.memory }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">硬盘:</td>
                                            <td><b>{{ assets.disk }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">网卡1mac地址:</td>
                                            <td><b>{{ assets.eth0 }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">网卡2mac地址:</td>
                                            <td><b>{{ assets.eth1 }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">网卡3mac地址:</td>
                                            <td><b>{{ assets.eth2 }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">网卡4mac地址:</td>
                                            <td><b>{{ assets.eth3 }}</b></td>
                                        </tr>

                                        <tr>
                                            <td width="20%">出厂时间:</td>
                                            <td><b>{{ assets.ship_time }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">到保时间:</td>
                                            <td><b>{{ assets.end_time }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">文件:</td>
                                            <td><b>  {% if  asset.file %}
                                                <a href="{{ assets.file.url }} ">{{ assets.file.name | lowers }}</a> {% endif %}
                                            </b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">备注:</td>
                                            <td><b>{{ assets.ps }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">创建时间:</td>
                                            <td><b>{{ assets.ctime }}</b></td>
                                        </tr>
                                        <tr>
                                            <td width="20%">更新时间:</td>
                                            <td><b>{{ assets.utime }}</b></td>
                                        </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-5" style="padding-left: 0;padding-right: 0">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <i class="fa fa-info-circle"></i> 快速修改
                                </div>
                                <div class="panel-body">
                                    <table class="table">
                                        <tbody>
                                        {#                                        <tr class="no-borders-tr">#}
                                        {#                                          <td   style=" border-top: none !important;" width="50%">激活:</td>#}
                                        {#                                            <td  style=" border-top: none !important;"><span class="pull-right">#}
                                        {#                                                <div class="switch">#}
                                        {#                                                    <div class="onoffswitch">#}
                                        {#                                                        <input type="checkbox" {% if assets.is_active %} checked {% endif %}  class="onoffswitch-checkbox" id="is_active">#}
                                        {#                                                        <label class="onoffswitch-label" for="is_active">#}
                                        {#                                                            <span class="onoffswitch-inner"></span>#}
                                        {#                                                            <span class="onoffswitch-switch"></span>#}
                                        {#                                                        </label>#}
                                        {#                                                    </div>#}
                                        {#                                                </div>#}
                                        {#                                            </span></td>#}
                                        {#                                        </tr>#}
                                        <tr>
                                            <td style=" border-top: none !important;">更新硬件信息:</td>
                                            <td style=" border-top: none !important;">
                                                <span class="pull-right">
                                                    <button type="button"
                                                            class="btn btn-primary btn-xs  asset_hardware_update"
                                                            style="width: 54px">刷新</button>

                                                </span>

                                            </td>

                                        </tr>
                                            <span id="error2" style="color:red;"></span>
                                        </tbody>
                                    </table>
                                </div>
                            </div>


                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>




    {% block footer-js %}

        <script type="text/JavaScript">
    $.ajaxSetup({headers: {"X-CSRFToken": '{{ csrf_token }}'}});
</script>



        <script>














            $(function () {
                $('.asset_del').click(function () {
                       swal({

                        title: "你确定删除",
                        text: "你将无法恢复",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "确定",
                        closeOnConfirm: false
                    }, function () {
                    $.ajax({
                        url: "/asset/asset-del.html",
                        type: 'POST',
                        data: {'nid': {{  nid }}},
                        success: function (data) {

                            var obj = JSON.parse(data);
                                if (obj.status) {
                                    swal({title: "删除", text: "已成功删除", type: "success"}, function () {
                                      location.href = "{% url "asset:asset_list" %}"
                                    })
                                } else {
                                    swal("错误", "删除" + "[ " + obj.error + " ]" + "遇到错误", "error");
                                }
                            }
                        });


                    });
                });


















                $('.asset_hardware_update').click(function () {

                    alert('关闭alert, 等待完成, 自动刷新页面');
                    $.ajax({
                        url: "/asset/asset-hardware-update.html",
                        type: 'POST',
                        data: {'nid': {{  nid }}},
                        success: function (data) {
                            var obj = JSON.parse(data);
                            if (obj.status) {
                                location.reload()
                            } else {
                                $('#error2').text(obj.error);
                            }
                        }
                    })
                });

            });




        </script>


    {% endblock %}


{% endblock %}


